<?php

namespace App\Models;
use Zhuzhichao\IpLocationZh\Ip;

class Apply extends Base
{
   public $timestamps = false;


    public function category() {
        return $this->belongsTo(Category::class, 'category_id');
    }


    public function parent_category() {
        return $this->belongsTo(Category::class, 'parent_category_id');
    }

    public function project() {
        return $this->belongsTo(Project::class, 'project_id');
    }

    public function getIpShowAttribute() {
        $ip = Ip::find($this->ip);
        return ($ip[1] ?? '') . ($ip[2] ?? '');
    }
}
